package com.itsitio.dbloader.servicio;

import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class UtilService {

	//texto a encriptar
	public static String hash(String toEncrypt) {
		MessageDigest md;
		try {
			md = MessageDigest.getInstance("MD5");
			byte[] messageDigest = md.digest(toEncrypt.getBytes());

			BigInteger number = new BigInteger(1, messageDigest);
			return number.toString(16);

		} catch (NoSuchAlgorithmException e) {
			throw new InternalError("Hashing algorythm not supported");
		}
	}
	
	
}
